package command;

import server.KVMessage.StatusType;
import util.IKeyValueStorage;

public class CommandDelete implements ICommand {
	private IKeyValueStorage storage;
	private String key;
	
	public CommandDelete(IKeyValueStorage storage, String key) {
		this.key = key;
		this.storage = storage;
	}
	
	@Override
	public String execute() {
		String value = (String) storage.remove(key);
		return ClientInputHandler.composeClientResponse(StatusType.DELETE_SUCCESS, key, value);
	}
}
